﻿
@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
    Layout = null;
}
<link href="~/lib/layui/css/layui.css" rel="stylesheet" />
@* <script src="~/lib/layui/layui.js"></script> *@
<script src="~/js/js.cookie.js"></script>
<script src="~/js/moment.js"></script>
<script src="~/lib/jquery/dist/jquery.js"></script>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>角色列表</title>
    <!-- 请勿在项目正式环境中引用该 layui.css 地址 -->

</head>
<body>
    <table class="layui-table" id="ID-table-demo-init">
        @*  <colgroup>
        <col width="150">
        <col width="150">
        <col>
        </colgroup> *@
        <thead>
            <tr>
                <th>序号</th>
                <th>角色</th>
                <th>权限</th>
                <th>状态</th>
                <th>操作 </th>
            </tr>
        </thead>
        <tbody id="ThisTb">
        </tbody>
    </table>

    <!-- 请勿在项目正式环境中引用该 layui.js 地址 -->
    <script src="//unpkg.com/layui@2.9.20/dist/layui.js"></script>
    <script>
        $(function () {
            getList();
        })

        function getList() {
            $.ajax({
                url: '@ViewBag.RBACWrite'+ "/api/RBAC/ListRoles",
                type: "get",
                dataType: "json",
                contentType: "application/json",
                success: function (res) {
                    $(res.data).each(function (i, item) {
                        $("#ThisTb").append(`<tr>
                                                <td>${i + 1}</td>
                                                <td>${item.rolesName}</td>
                                                <td>${item.per}</td>
                                                <td>${item.state}</td>
                                                <td>
                                                     <button type="button" class="layui-btn layui-bg-blue">编辑</button>
                                                     <button type="button" class="layui-btn layui-bg-orange">删除</button>
                                                </td>
                                            </tr>`)
                    })
                }
            })
        }
    </script>
</body>
</html>